
<CFQUERY NAME="getPowerUser" DATASOURCE="#client.company_dsn#">
    SELECT Count(PERSONNELIDNO) AS COUNT
    FROM CINWSPOWERUSER 
    WHERE PERSONNELIDNO ='#client.chapa#'
</CFQUERY>

<cfif isDefined("Form.Filter")>            
	<CFSET ORD = Form.ascdesc>   
<cfelse>
	<CFSET ORD = "DESC">   
</cfif>


<CFQUERY NAME="QueryView" DATASOURCE="#CLIENT.COMPANY_DSN#">
    SELECT DOCNUMBER, FILENAME, DATEFROM, DATETO, REMARKS, RECDATECREATED, RECCREATEDBY
    FROM CINWSFILE
    	<cfif isDefined("Form.Filter")>
        	<CFSET COLNME = Form.cmbsort>
            <CFSET VALUE = Form.edtValFilter>
        	WHERE #COLNME# LIKE '#VALUE#%'
        </cfif>
    ORDER BY DOCNUMBER #ORD#, RECDATECREATED #ORD#
</cfquery>

<cfif isDefined("client.err")>
	<p id="err"><cfoutput><b>#client.err#</b></cfoutput></p>
    <cfset client.err ="">
</cfif>

<cfif getPowerUser.Count>
	<cfset lstAddtnlButton = "addFile~Add New File~Add new manning form">
</cfif>
<cfset FRMNAME = "sform">
<cfset lstOrder = "
			File Name~FILENAME~ftstring,
			Created by~RECCREATEDBY~ftstring">

<CFMODULE TEMPLATE = "#CLIENT.COMMON_PATH#cfm_wswindow.cfm" TITLE = "Browse Files">
<BODY TOPMARGIN = 0 BOTTOMMARGIN = 0 LEFTMARGIN = 0 BGCOLOR = "#FFFFFF">
<CFFORM METHOD = "POST" NAME = "#FRMNAME#">
<TABLE WIDTH = "100%" CELLSPACING = 0 CELLPADDING = 3>
    <TR BGCOLOR = "<cFOUTPUT>#CLIENT.COLOR_TBLHEAD#</cFOUTPUT>" >
        <TD NOWRAP COLSPAN = 5>
         <cfinclude template="toolbar.cfm">
        </TD>
    </TR>
    <TR>
    	<TD width="20%">&nbsp;&nbsp;&nbsp;</TD>
    	<TD width="10%">File Name</TD>
        <TD>From</TD>
        <TD>To</TD>
        <TD>Date Created</TD>
        <TD>Created By</TD>
    </TR> 
    <CFIF NOT QueryView.RECORDCOUNT>
    <TR>
        <TD CLASS = "BOLD" COLSPAN = 6 align="center">
        	<BR>No records found in the current filter.
        </TD>
    </TR>
	<CFELSE>
	<cfif NOT nStartrow>
    	<CFSET nStartrow =1>
    </cfif> 
    <cfoutput query="QueryView" STARTROW = "#nStartrow#" MAXROWS = "#EVALUATE(nEndrow - nStartrow + 1)#">
    <cfset id = URLEncodedFormat( Encrypt( DOCNUMBER, CLIENT.EK ) ) >
    <TR class="row" BGCOLOR = "#IIF(CURRENTROW MOD 2, "CLIENT.COLOR_TBLSET2", "CLIENT.COLOR_TBLSET1")#">
        <TD align="center">
        	<a href="#client.domain#eworksched/manning/index.cfm?vw=#id#" id="lk">
                open
            </a>
            &nbsp;&nbsp;
            <cfif getPowerUser.Count>
                <a href="#client.domain#eworksched/manning/index.cfm?del=#id#&name=#FILENAME#" 
                	onclick = "if (confirm('Delete #FILENAME#?')) {return true;} else {return false;}" id="lk"
                >
                    delete
                </a>
            </cfif>        
        </TD>
        <TD>#FILENAME#</TD>
        <TD>#DateFormat(DATEFROM, "MMM. DD, YYYY")#</TD>
        <TD>#DateFormat(DATETO, "MMM. DD, YYYY")#</TD>
        <TD>#DateFormat(RECDATECREATED, "MMM. DD, YYYY")#</TD>
        <TD>#RECCREATEDBY#</TD>
    </TR>
    </cfoutput>
    <TR><TD>&nbsp;</TD></TR>
  	<TR>
      <TD HIEGHT = 18 BGCOLOR = "#CLIENT.COLOR_TBLFOOT#" WIDTH = "100%" COLSPAN = 6 style="color:black"> 
          <cfoutput>
          &nbsp;Records:&nbsp;#nStartrow#-#neNDrow#&nbsp;&nbsp;of&nbsp;&nbsp;#QueryView.RECORDCOUNT#
          </cfoutput>
      </TD>
    </TR>
    </CFIF>
</TABLE>
</CFFORM>
</BODY>
<CFMODULE TEMPLATE="#CLIENT.COMMON_PATH#cfm_wswindow.cfm" TOP ="FALSE">

<script>
	window.onload = onShow();
</script>